﻿using System;
using System.Collections.Generic;
using System.Text;
using TSVNAddin.Config;

namespace TSVNAddinUtils
{
	public class MakeConfigCommand : UtilsCommandBase
	{
		private readonly RegistryAdapter _Registry;
		private readonly ConfigStorage _ConfigStorage;

		public MakeConfigCommand(RegistryAdapter registry, ConfigStorage configStorage)
		{
			_Registry = registry;
			_ConfigStorage = configStorage;
		}

		protected override void InternalExec(string[] args)
		{
			string keyName = @"SOFTWARE\TortoiseSVN";

			AddinConfig config = new AddinConfig();
			config.TMergePath = _Registry.GetValue(keyName, "TMergePath");
			config.ProcPath = _Registry.GetValue(keyName, "ProcPath");

			_ConfigStorage.StoreAddinConfig(config);

			Console.WriteLine("MakeConfigCommand: completed.");
		}
	}
}
